package jfprincesstests.structures;

import laboratoryQ.junit.ignore.patch.BaseTestCase;
import jfuzzyprincepless.zarchive.variables.IFuzzySet;
import jfuzzyprincepless.zarchive.variables.FuzzySet;

public class TestVariables extends BaseTestCase {
	public void testFuzzySet() {
		IFuzzySet<Integer> fuzzySet = new FuzzySet<Integer>();
		assertEquals(0, fuzzySet.getElements().size());
		assertEquals(0.0, fuzzySet.getMembershipDegree(123));

		fuzzySet.add(123, 0.1);
		fuzzySet.add(456, 0.5);
		fuzzySet.add(789, 0.9);
		assertEquals(3, fuzzySet.getElements().size());
		assertEquals(0.1, fuzzySet.getMembershipDegree(123));

		StringBuilder sb = new StringBuilder();
		for (Integer elem : fuzzySet.getElements()) {
			sb.append(elem).append(": ")
				.append(fuzzySet.getMembershipDegree(elem))
				.append("; ");
		}
		assertEquals("123: 0.1; 456: 0.5; 789: 0.9; ", sb.toString());
	}
}
